package com.example.jsonquynh;

import java.io.UnsupportedEncodingException;

import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;

public class Place implements Parcelable {
	private String ID;
	private String title;
	private String address;
	private String position;
	private String description;
	private String thumbnail;
	private String images;
	static public String JSON_ID = "id";
	static public String JSON_NAME = "name";
	static public String JSON_ADDRESS = "add";
	static public String JSON_POSITION = "pos";
	static public String JSON_THUMB = "thumb";
	static public String JSON_IMAGES = "img";
	static public String JSON_DESCRIPTION = "des";

	public Place(String ID, String title, String address, String position,
			String description, String thumbnail, String images) {
		this.ID = ID;
		this.title = title;
		this.address = address;
		this.position = position;
		this.description = description;
		this.thumbnail = thumbnail;
		this.images = images;

	}

	public void setID(String string) {
		this.ID = string;
	}

	public void setTitle(String string) {
		this.title = string;
	}

	public void setAddress(String string) {
		this.address = string;
	}

	public void setPosition(String string) {
		this.position = string;
	}

	public void setDescription(String string) {
		this.description = string;
	}

	public void setThumbnai(String string) {
		this.thumbnail = string;
	}

	public void setImages(String string) {
		this.images = string;
	}

	public void addImage(String string) {
		if (images == null) {
			images = "";
		}
		images += string + ";";
	}

	public String getID() {
		return ID;
	}

	public String getTitle() {
		return title;
	}

	public String getAddress() {
		return address;
	}

	public String getPosition() {
		return position;
	}

	public String getDescription() {
		return description;
	}

	public String getThumbnai() {
		return thumbnail;
	}

	public String getImages() {
		return images;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	public static final Parcelable.Creator<Place> CREATOR = new Parcelable.Creator<Place>() {
		public Place createFromParcel(Parcel in) {
			return new Place(in.readString(), in.readString(), in.readString(),
					in.readString(), in.readString(), in.readString(),
					in.readString());
		}

		public Place[] newArray(int size) {
			return new Place[size];
		}
	};

	@Override
	public void writeToParcel(Parcel out, int arg1) {
		out.writeString(ID);
		out.writeString(title);
		out.writeString(address);
		out.writeString(position);
		out.writeString(description);
		out.writeString(thumbnail);
		out.writeString(images);
	}

}
